package cn.iocoder.yudao.module.project.dal.mysql.kisbatchcode;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.kisbatchcode.KisBatchCodeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.kisbatchcode.vo.*;

/**
 * 批次码 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface KisBatchCodeMapper extends BaseMapperX<KisBatchCodeDO> {

    default PageResult<KisBatchCodeDO> selectPage(KisBatchCodePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KisBatchCodeDO>()
                .likeIfPresent(KisBatchCodeDO::getMaterialCode, reqVO.getMaterialCode())
                .likeIfPresent(KisBatchCodeDO::getSupplierId, reqVO.getSupplierId())
                .likeIfPresent(KisBatchCodeDO::getBatchCode, reqVO.getBatchCode())
                .betweenIfPresent(KisBatchCodeDO::getCreateTime, reqVO.getCreateTime())
                // .apply("supplier_id in (select id from where id = {0})",reqVO.getSupplierId())
                .orderByDesc(KisBatchCodeDO::getId));
    }

}